<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ page import="com.hzqy.commons.utils.ConstantUtils" %>
<%@ page import="com.hzqy.web.vo.PmsUserVo" %>
<%@ taglib prefix="limits" uri="/WEB-INF/tld/limits.tld"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>节目管理</title>
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/defalut.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/public.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/ddspstyle.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/icon.css">
<link href="../../static/css/uploadify.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css"	href="../../static/js/WdatePicker/skin/WdatePicker.css">


<script type="text/javascript" src="../../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../../static/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../../static/js/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../../static/js/index.js"></script>
<script type="text/javascript" src="../../static/js/WdatePicker/WdatePicker.js"></script>
<script src="../../static/js/jquery.uploadify.js" type="text/javascript"></script>

<%
String []nonceObj=ConstantUtils.getNonceObject();
PmsUserVo userVo=(PmsUserVo)session.getAttribute(ConstantUtils.SESSION_USER);
String roleType="0";
if(userVo!=null){
	roleType=userVo.getRoleIds();
}
%>

<script type="text/javascript">
		var queryParams;
		function EasyuiDatagrid() {
			$("#easyui-datagrid").datagrid({
				url: '../../content/content_list.do',
				nowrap: true,
				striped: true,
				border: false,
				fit: true,
				rownumbers:true,
				queryParams: getGueryParams(),
				columns: [[
					{field:'id',checkbox:true},
					{field:'f_cc_id',title:'ID',align:'center',width:50},
					{field:'f_cc_companyname',title:'行业客户',align:'center',width:150},
					{field:'f_cc_name',title:'节目名称',align:'center',width:150},
					{field:'f_cc_code',title:'播放码',align:'center',width:150},
					{field:'f_cc_outputType',title:'转码类型',align:'center',width:60,
						formatter:function(value,row,index) {
							var status = "未知";
							if(value==1){
								status="720*576";
							}else if(value==2){
								status="1280*720";
							} else if(value==3){
								status="1920*1080";
							} 
							return status;
						}	},
					{field:'f_cc_interfaceType',title:'上传平台',align:'center',width:60,
							formatter:function(value,row,index) {
								var status = "未知";
								if(value==0){
									status="不上传";
								}else if(value==1){
									status="华为中兴";
								}else if(value==2){
									status="中兴";
								} else if(value==3){
									status="华为";
								} 
								return status;
							}	
						},
					{field:'f_cc_cpid',title:'CPID',align:'center',width:60},
					{field:'f_cc_type',title:'类型',align:'center',width:60,
						formatter:function(value,row,index) {
							var status = "未知";
							if(value==2){
								status="电影";
							}else if(value==3){
								status="直播";
							} else if(value==4){
								status="图文";
							} else if(value==5){
								status="链接";
							}
							return status;
						}	
					},
					
					{field:'f_cc_status',title:'状态',align:'center',width:80,
						formatter:function(value,row,index) {
							var status = "未知";
							if(value==1){
								status="上线";
							} else if(value==2||value==16||value==14){
								status="待审核";
							} else if(value==4||value==13||value==15){
								status="审核未通过";
							}else if(value==5){
								status="待转码";
							}else if(value==6){
								status="正在转码";
							}else if(value==7){
								status="转码失败";
							}else if(value==8){
								status="等待资源";
							}else if(value==9){
								status="资源缺失";
							}else if(value==10){
								status="资源格式容量不正确";
							}else if(value==11){
								status="待处理";
							}else if(value==12){
								status="不通过";
							}else if(value==17){
								status="等待传输";
							}else if(value==18){
								status="传输失败";
							}else if(value==19){
								status="传输中";
							}else if(value==20){
								status="等待删除";
							}else if(value==21){
								status="删除传输中";
							}else if(value==22){
								status="删除失败";
							}
							return status;
						}	
					},
					{field:'f_cc_duration',title:'视频时长',align:'center',width:60,
						formatter:function(value,row,index) {
							return value;
						}	
					},
					{field:'f_cc_udate',title:'更新时间',align:'center',width:150,
						formatter:function(value,row,index) {
							var str = "";
							if(value!=null)
								str = value.substring(0,19);
							return str;
						}	
					},
					{field:'f_cc_cdate',title:'添加时间',align:'center',width:150,
						formatter:function(value,row,index) {
							var str = "";
							if(value!=null)
								str = value.substring(0,19);
							return str;
						}	
					},
					{field:'f_cc_remark',title:'审核描述',align:'center',width:150,
						formatter:function(value,row,index) {
						var str = "";
						if(row.f_cc_status==1){
							str = "审核结束";
						}else if(row.f_cc_status==2){
							str = "市公司审核中";
						}else if(row.f_cc_status==16){
							str = "省公司审核中";
						}else if(row.f_cc_status==14){
							str = "牌照审核中";
						}else{
							if(value){
								str=value;
							}
						}
						return str;
						}	
					},
					{field:'f_cc_provincedate',title:'省电信审核时间',align:'center',width:150},
					{field:'f_cc_licensedate',title:'文广审核时间',align:'center',width:150,
						formatter:function(value,row,index) {
							var str = "";
							if(value!=null)
								str = value.substring(0,19);
							return str;
						}	
					},
					/* {field:'f_cc_medioType',title:'视频属性',align:'center',width:150,
						formatter:function(value,row,index) {
							var status = "";
							if(value==1){
								status="戏曲";
							} else if(value==2){
								status="党建";
							} else if(value==3){
								status="教育";
							} else if(value==4){
								status="其他";
							} else if(value==5){
								status="体育";
							} else if(value==6){
								status="美食";
							} else if(value==7){
								status="娱乐";
							} else if(value==8){
								status="医疗";
							} else if(value==9){
								status="新闻";
							}else if(value==10){
								status="企业宣传";
							}
							return status;
						}	
					}, */
					{field:'f_cc_transcodePath',title:'视频文件',align:'center',width:150},
					{field:'_parentId',title:'操作',align:'center',width:450,
						formatter:function(value,row,index){
							str ="";
							
							if(row.f_cc_status!=20 && row.f_cc_status!=21 && row.f_cc_status!=22){
								<limits:uiAuth url="delete_content.do">	
								str= '<a class="easyui-linkbutton l-btn l-btn-plain" iconCls="icon-ok" href="javascript:void(0);" plain="true" onclick="onClickBtnDelete(\''+row.f_cc_id+'\',\''+row.f_cc_status+'\');" ><span class="l-btn-left"><span class="l-btn-text icon-remove l-btn-icon-left">删除</span></span></a>';
								</limits:uiAuth>
							}
							<limits:uiAuth url="industry/selectC2BascHistroyByContentId.do">	
								str+= '<a class="easyui-linkbutton l-btn l-btn-plain" iconCls="icon-ok" href="javascript:void(0);" plain="true" onclick="showHistroyMessage(\''+row.f_cc_id+'\');" ><span class="l-btn-left"><span class="l-btn-text icon-remove l-btn-icon-left">报文查看</span></span></a>';
							</limits:uiAuth>
							if(row.f_cc_status==2 ||row.f_cc_status==15||row.f_cc_status==13||row.f_cc_status==4||row.f_cc_status==1||row.f_cc_status==18||row.f_cc_status==7){
								<limits:uiAuth url="update_content.do">	
								str+= '<a class="easyui-linkbutton l-btn l-btn-plain" iconCls="icon-ok" href="javascript:void(0);" plain="true" onclick="edit(\''+row.f_cc_id+'\');" ><span class="l-btn-left"><span class="l-btn-text icon-edit l-btn-icon-left">修改</span></span></a>';
								</limits:uiAuth>
							}
							if(row.f_cc_status==18){
								<limits:uiAuth url="content/update_content_status.do">	
								str+= '<a class="easyui-linkbutton l-btn l-btn-plain" iconCls="icon-ok" href="javascript:void(0);" plain="true" onclick="repeat(\''+row.f_cc_id+'\',17);" ><span class="l-btn-left"><span class="l-btn-text icon-edit l-btn-icon-left">自动重传</span></span></a>';
								</limits:uiAuth>
							}
							if(row.f_cc_status==22){
								<limits:uiAuth url="content/update_content_status.do">	
								str+= '<a class="easyui-linkbutton l-btn l-btn-plain" iconCls="icon-ok" href="javascript:void(0);" plain="true" onclick="repeat(\''+row.f_cc_id+'\',20);" ><span class="l-btn-left"><span class="l-btn-text icon-edit l-btn-icon-left">重新请求删除</span></span></a>';
								</limits:uiAuth>
							}
							if(row.f_cc_status==7){
								<limits:uiAuth url="content/update_content_status.do">	
								str+= '<a class="easyui-linkbutton l-btn l-btn-plain" iconCls="icon-ok" href="javascript:void(0);" plain="true" onclick="repeat(\''+row.f_cc_id+'\',5);" ><span class="l-btn-left"><span class="l-btn-text icon-edit l-btn-icon-left">自动重传</span></span></a>';
								</limits:uiAuth>
							}
			    			//市公司
			    			<limits:uiAuth url="review_content.do">	
					    		<limits:uiAuth url="city_review_power">	
						    		if(row.f_cc_status==2 || row.f_cc_status==4) {
						    			str+='<a class="easyui-linkbutton l-btn l-btn-plain" iconCls="icon-ok" href="javascript:void(0);" plain="true" onclick="review(\''+row.f_cc_id+'\');" ><span class="l-btn-left"><span class="l-btn-text icon-ok l-btn-icon-left">市公司审核</span></span></a>';
						    		}
					    		</limits:uiAuth>
					    		//省公司审核
					    		<limits:uiAuth url="province_review_power">	
					    			if(row.f_cc_status==16 || row.f_cc_status==13) {
					    				str+='<a class="easyui-linkbutton l-btn l-btn-plain" iconCls="icon-ok" href="javascript:void(0);" plain="true" onclick="review(\''+row.f_cc_id+'\');" ><span class="l-btn-left"><span class="l-btn-text icon-ok l-btn-icon-left">省公司审核</span></span></a>';
					    			}
					    		</limits:uiAuth>
					    		//牌照方审核
					    		<limits:uiAuth url="license_review_power">	
					    		if(row.f_cc_status==14 || row.f_cc_status==15) {
					    			str+='<a class="easyui-linkbutton l-btn l-btn-plain" iconCls="icon-ok" href="javascript:void(0);" plain="true" onclick="review(\''+row.f_cc_id+'\');" ><span class="l-btn-left"><span class="l-btn-text icon-ok l-btn-icon-left">牌照方审核</span></span></a>';
					    		}
					    		</limits:uiAuth>
				    		</limits:uiAuth>
					    	return str;
				    	}
					}
				]],
				singleSelect:false,
				pagination:true,
				pageList:[10,20,30,40,50],
				pageSize:10,
				toolbar: '#toolbar',
				
				onExpandRow: function(index,row){
				
				},
				onSelect: function(rowIndex,rowData) {
					
				},
				onUnselect: function(rowIndex,rowData) {
					
				},
				onCheckAll: function(rowIndex,rowData) {
					
				},
				onUncheckAll: function(rowIndex,rowData) {
				
				},
				onLoadSuccess: function(data) {
					if(data.total==-1) {
						$.messager.defaults={ok:"确定",cancel:"取消"};
						$.messager.confirm('提示', '用户尚未登录,请登录', function(r){
						if (r){
						    window.parent.location.href='/login.do';
						    return false;
						}});
					}
				}
			});
		}
	
		function getGueryParams(){
			return {
				f_cc_name:$("#f_cc_name").val(),
				f_cc_status:$("#f_cc_status").val(),
				f_cc_type:2,
				f_cc_companyid:$("#f_cc_companyid").val(),
				sctt_endDate:$("#sctt_endDate").val(),
				sctt_startDate:$("#sctt_startDate").val()
			};
		}
		
		$(function(){
			$.ajax({
				url:"../../pms/org_list.do",
				success:function(data) {
					data = JSON.parse(data);
					var str = "";
					for(var i=0;i<data.length;i++) {
						str+='<option value="'+data[i].id+'">'+data[i].name+'</option>';
					}
					$("#f_cc_companyid").append(str);
					
					$("#orgSpan").append($("#f_cc_companyid").clone(true));
				}
			});
			new EasyuiDatagrid();
			gotoSearch = function(){
				$("#easyui-datagrid").datagrid('reload',getGueryParams());
			};
			
			onClickBtnDelete = function(id,_status){
				$.messager.confirm('确定删除节目','确定删除节目么?',function(r){
					if(r){
						var url='../../content/delete_content.do?f_cc_id='+id;
						if(_status==1){
							url='../../content/update_content_status.do?f_cc_id='+id+"&f_cc_status=20";
						}
						app_ajax(url,
						'',
						function(msg){
							if(msg.success) {
									alert("删除成功!");
								
								if (checkAjaxRequestValidity(msg)) {
									gotoSearch($('#easyui-treegrid'));
								}
							} else {
								alert("删除异常，请联系管理员");
								if($.isFunction(window.showMessager)){
									window.showMessager(msg.resultTitle,msg.result);
								}
							}
						}
						);
					}
				});
			};
			
			$("#chooseOption1").on("change", function(){
				if($(this).val() == 1){
					$("#chooseOption2").show();
				} else {
					$("#chooseOption2").hide();
				}
			});
			
			
		});
		
		function SubgridTabOnSelect(title,index){
			setTimeout(function(){
				$("#easyui-datagrid").datagrid('fixDetailRowHeight',index);
			},300);
			setTimeout(function(){
				$("#easyui-datagrid").datagrid('fixDetailRowHeight',index);
			},3000);
	    }
		
		function load(){
			$(".datagrid-row-expander datagrid-row-expand").attr("display","none"); 
		}
		
		function _resert(){
			$("#f_cc_name").val("");
			$("#f_cc_status").val("");
		}
		
		function onpress(){
			var event=arguments.callee.caller.arguments[0]||window.event;//消除浏览器差异
	   		  	if (event.keyCode == 13){  
	      			gotoSearch($('#easyui-treegrid'));
	    		}
		}
		
		function edit(id){
			openDialog($("#dlg"),'content_update.jsp?f_cc_id='+id);
		}
		<limits:uiAuth url="content/update_content_status.do">	
		function repeat(id,status){
			$.ajax({
				url:"../../content/update_content_status.do",
				type:"post",
				data:{"f_cc_id":id,
					"f_cc_status":status},
				dataType:"json",
				success:function(data) {
					if(data.success) {
						alert("重新发起成功!");
						gotoSearch($('#easyui-treegrid'));
					} else {
						alert("重新发起失败!，请联系管理员");
					}
				}
			});
			
			
		}
		</limits:uiAuth>
		function show(id){
			openDialog($('#dlg'),'content_info.jsp?f_cc_id='+id);
		}
		function showHistroyMessage(id){
			openDialog($('#base_histroy'),'c2_basic_history_list.jsp?f_cc_id='+id);
		}
		function add(){
			openDialog($('#dlg'),'content_add.jsp');
		}
		
		function series(id) {
			openDialog($('#seriesdlg'),'series_list.jsp?f_cc_id='+id);
		}
		
		function review(id) {
			openDialog($('#dlg'),'content_review.jsp?f_cc_id='+id);
			// openDialog($('#dlg'),'content_review_no_transcode.jsp?f_cc_id='+id);//审核完成直接上线
		}
		
		function bind(id) {
			openDialog($('#dlg'),'content_bind.jsp?f_cc_id='+id);
		}
		
		function batchReview() {
			var rows = $("#easyui-datagrid").datagrid('getSelections');
			var ids = '';
			if(rows.length <= 0) {
				alert("请至少选择一条记录!");
			} else {
				for(var i=0;i<rows.length;i++) {
					if(rows[i].f_cc_status == 2 || rows[i].f_cc_status == 4/* || rows[i].f_cc_status == 7 */)
						ids += rows[i].f_cc_id + ',';
				}
				ids = ids.substring(0, ids.length - 1);
				if(ids.length <= 0) {
					alert("请选择至少一条未上线的节目");
				} else {
					$.ajax({
						url:"batch_review_content.do",
						dataType : 'json',
						data : {ids : ids},
						type : 'get',
						success:function(data) {
							alert(data.result);
							gotoSearch($('#easyui-treegrid'));
						}
					});
				}
			}
		}
		
		function batchUnReview() {
			var rows = $("#easyui-datagrid").datagrid('getSelections');
			var ids = '';
			if(rows.length <= 0) {
				alert("请至少选择一条记录!");
			} else {
				if(confirm("确认是否下线这些记录？")){
					for(var i=0;i<rows.length;i++) {
						ids += rows[i].f_cc_id + ',';
					}
					ids = ids.substring(0, ids.length - 1);
					$.ajax({
						url:"batch_unreview_content.do",
						dataType : 'json',
						data : {ids : ids},
						type : 'get',
						success:function(data) {
							alert(data.result);
							gotoSearch($('#easyui-treegrid'));
						}
					});
					
				}
			}
		}
		
		function batchDelete() {
			var rows = $("#easyui-datagrid").datagrid('getSelections');
			
			if(rows.length <= 0) {
				alert("请至少选择一条记录!");
			} else {
				if(confirm("确认是否删除这些记录？")){
					
					var needFlag=0;
					var deleteSuccessFlag=0;
					var deleteFailedFlag=0;
					
					for(var i=0;i<rows.length;i++) {
						if(rows[i].f_cc_status!=20 && rows[i].f_cc_status!=21 && rows[i].f_cc_status!=22){
							needFlag++;
						}
					}
					
					for(var i=0;i<rows.length;i++) {
						
						if(rows[i].f_cc_status!=20 && rows[i].f_cc_status!=21 && rows[i].f_cc_status!=22){
							
							var updateUrl='../../content/delete_content.do?f_cc_id='+rows[i].f_cc_id;
							if(rows[i].f_cc_status==1){
								updateUrl='../../content/update_content_status.do?f_cc_id='+rows[i].f_cc_id+"&f_cc_status=20";
							}
							
							app_ajax(updateUrl,'',function(msg){
										if(msg.success) {
											deleteSuccessFlag++;
										} else {
											deleteFailedFlag++;
										}
									});
						}
						
					}
					
					if(needFlag==(deleteSuccessFlag+deleteFailedFlag)){
						alert("本次批量删除共需删除"+needFlag+"个文件，失败"+deleteFailedFlag+"个文件，成功"+deleteSuccessFlag+"个文件");
						//window.showMessager("提示信息","本次批量删除共需删除"+needFlag+"个文件，失败"+deleteFailedFlag+"个文件，成功"+(needFlag-deleteFailedFlag)+"个文件");
						gotoSearch($('#easyui-treegrid'));
					}
					
				}
			}
		}
		
		function contentSelectAdvertisement(id){
			openDialog($('#dlg'),'content_advertisement.jsp?f_cc_id='+id+"&f_ccadver_type=2");
		}
		function bind() {
			openDialog($('#org_list'),'../behavior_control/org_update.jsp?idField=f_cc_companyid&nameField=f_cc_company_name');
		}
		function batch_content() {
			openDialog($('#batch_page'),'stream.jsp');
			// openDialog($('#batch_page'),'stream_local.jsp');不转码
		}
		
		function resert(){
			$("#f_cc_company_name").val("");
			$("#f_cc_companyid").val("");
		}
	</script>
</head>
<body onload="load();" style="width: 100%;">
	<input type="hidden" id="sessionId" value="${pageContext.session.id}" />
	<table id="easyui-datagrid" title="节目列表"></table>
	<div id="toolbar" class="easyui_datagrid_toolbar" style="">
		<div class="easyuiSearch">
			<form onsubmit="return false;" method="post">
				<table cellspacing="0" cellpadding="0" width="90%">
					<tr>
						<td align="left" width="7%">节目名称:</td>
						<td align="left" width="15%"><input name="f_cc_name" id="f_cc_name" style="width: 150px;" onkeydown="onpress();" /></td>
						<td align="left" width="7%">状态:</td>
						<td align="left" width="16%">
							<select id="f_cc_status" name="f_cc_status">
									<option value="0">请选择</option>
									<option value="1">上线</option>
									<option value="2">市级审核中</option>
									<option value="4">市审核未通过</option>
									<option value="5">待转码</option>
									<option value="6">正在转码</option>
									<option value="7">转码失败</option>
									<option value="16">省级审核中</option>
									<option value="13">省审核未通过</option>
									<option value="14">牌照方审核中</option>
									<option value="15">牌照方审核未通过</option>
									<option value="17">等待传输</option>
									<option value="18">传输失败</option>
									<option value="19">传输中</option>
									<option value="20">等待删除</option>
									<option value="21">删除传输中</option>
									<option value="22">删除失败</option>
							</select>
						</td>
						<td align="left" width="7%">
							操作日期：
						</td>
						<td align="left" width="15%">
							<input id="sctt_startDate" name="sctt_startDate" type="text" onClick="WdatePicker()" style="width: 150px;" value="" class="yl_inp yw_name" />	
						</td>
						<td align="left" width="5%">
							&nbsp至
						</td>
						<td align="left" >
							<input id="sctt_endDate" name="sctt_endDate" type="text" onClick="WdatePicker()" style="width: 150px;" value="" class="yl_inp yw_name" />
						</td>
					
					</tr>
					<tr>
						<td  align="left" width="10%">
							行业客户:
						</td>
						<td align="left" width="30%">
							<input name="f_cc_company_name" id="f_cc_company_name" readonly="readonly"	style="width: 150px;" value="" class="yl_inp yw_name" />
							<input name="f_cc_companyid" id="f_cc_companyid" type="hidden" value="" />  
							<input name="status" id="status" type="hidden" value="nochange" />  
							<!-- <select id="f_cc_companyid" name="f_cc_companyid" style="width: 150px;">
							</select> -->
							<!-- <span id="f_cc_companyid_tip" class="tip"></span> -->
							<a id="12" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);" onclick="resert()">空选</a>
							<a id="12" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);"
								onclick="bind();">选择</a>
						</td>
							<td align="left" width="15%">
							<limits:uiAuth url="content_list.do">
								<a href="javascript:void(0);" class="easyui-linkbutton"
									data-options="iconCls:'icon-search', plain:true"
									onclick="gotoSearch($('#easyui-datagrid'))">查询</a>
							</limits:uiAuth>
						</td>
						<td align="left" width="10%">
								<a href="javascript:void(0);" class="easyui-linkbutton"
									data-options="iconCls:'icon-add', plain:true" onclick="add()">增加节目</a>
						</td>
						<td align="left" width="10%">
							<limits:uiAuth url="content_excel_list.do">
								<a href="javascript:void(0);" class="easyui-linkbutton"
									data-options="iconCls:'icon-save', plain:true"
									onclick="javascript:exportExcel()">导出Excle</a>
							</limits:uiAuth>
						</td>
						<td align="left" width="15%">
							<limits:uiAuth url="stream.jsp">
								<a id="12" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);"
								onclick="batch_content();">视频批量上传</a>
							</limits:uiAuth>
							
						</td>
						<td>
							
						</td>
						<td>
							<limits:uiAuth url="batch_delete_different_type_content.do">
								<a href="javascript:void(0);" class="easyui-linkbutton"
									data-options="iconCls:'icon-no', plain:true"
									onclick="batchDelete()">批量删除</a>
							</limits:uiAuth>
						</td>
					</tr>
				</table>
			</form>
		</div>
		<div style="margin-bottom: 5px">
			<!-- <a href="javascript:void(0)" class="easyui-linkbutton" onclick="delete();" iconCls="icon-cut" plain="true">删除</a>  -->
		</div>
	</div>
	<div id="dlg" class="easyui-dialog"
		style="width: 950px; height: 600px; padding-top: 0px;"
		data-options="title:'节目管理', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
			style="width: 100%; height: 99%;"></iframe>
	</div>
	<div id="seriesdlg" class="easyui-dialog"
		style="width: 1000px; height: 600px; padding-top: 0px;"
		data-options="title:'剧集管理', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
			style="width: 100%; height: 99%;"></iframe>
	</div>
	<div id="org_list" class="easyui-dialog"
		style="width: 800px; height: 500px; padding-top: 0px;"
		data-options="title:'客户选择', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
			style="width: 100%; height: 99%;"></iframe>
	</div>
	<div id="batch_page" class="easyui-dialog"
		style="width: 800px; height: 500px; padding-top: 0px;"
		data-options="title:'客户选择', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
			style="width: 100%; height: 99%;"></iframe>
	</div>
	<div id="base_histroy" class="easyui-dialog"
		style="width: 950px; height: 600px; padding-top: 0px;"
		data-options="title:'报文列表', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
			style="width: 100%; height: 99%;"></iframe>
	</div>
	
	<div id="win" class="easyui-window" closed="true" modal="true" iconCls="icon-save" style="width:440px; height: 290px; left: 50%px;top: 30%;" title="节目批量导入">
		<div class="easyui-layout" fit="true">
			<div region="north" border="true" style="height: 40;">
				<a class="easyui-linkbutton" style="line-height: 20px; padding-bottom: 3px;" iconCls="icon-undo" plain="true" href="../../static/excel/节目批量导入模版.xlsx">下载模版&nbsp;</a>
			</div>
			
			<div region="center" border="true">
				<div>
					<p>
						<font size="6" style="font-weight: bold;color: gray;">批量导入说明:</font><br/>
						&nbsp;&nbsp;1. 选择组织(必须):<span id="orgSpan"></span><br/>
						&nbsp;&nbsp;2. 导入选项:&nbsp;&nbsp;&nbsp;<select id="chooseOption1" name="chooseOption1">
																	<option value="0">默认</option>
																	<option value="1">帐号导入(去重)</option>
																</select>
																<select id="chooseOption2" name="chooseOption2" style="display: none;">
																	<option value="1">电视剧</option>
																	<option value="2">电影</option>
																	<option value="3">直播</option>
																	<option value="4">图文</option>
																	<option value="5">链接</option>
																	<option value="7">转码视频</option>
																	<option value="20">组织模板</option>
																	<option value="100" selected="selected">业务账号</option>
																	<option value="110">其他</option>
																</select><br/>
						&nbsp;&nbsp;3. 节目类型 1:电视剧, 2:电影, 3:直播, 4:图文, 5:链接, 7:转码视频, 100:业务账号, 110:其他<br/>
						&nbsp;&nbsp;4. 是否完结 未完结:0, 完结:1 <br/>
						&nbsp;&nbsp;5. 所有节目都收费<br/>
						&nbsp;&nbsp;6. 上线时间为当前时间<br/>
						&nbsp;&nbsp;7. 下线时间2099-12-31 23:59:59<br/>
					</p>
				</div>
			</div>
			
			<div region="south" border="false" style="text-align:left;height:40px;padding: 3px">
				<input id="uploadFile2"  type="file" name="file"/>
			</div>
			
		</div>
	</div>
	

<script type="text/javascript">
	$(function(){
		$('#win').window({
	       onBeforeClose:function(){ 
				//window.location.reload();	
	       }
		});
		initFileUpload("#uploadFile2", {});
	});
	
	function batch_add(){
		$('#win').window('open');
	}
	
	function initFileUpload(inputId, params){
		var action = 'insert_batch_content.do;jsessionid='+$("#sessionId").val();
		$(inputId).uploadify({
			'swf'           :'../../swf/uploadify.swf',
			'uploader'      :action,
			'formData'      :params,
			'fileObjName'   :'uploadify',
			'cancelImg' 	:"../../imgs/uploadify-cancel.png",
			'queueId'		:"fileQueue",
			'fileTypeDesc'  :"Excel File",
			'fileTypeExts'	:"*.xls; *.xlsx",//限制文件类型
			'auto'			:true,//是否自动上传
			'multi'			:false,//是否允许多文件上传
			'buttonText'	:"导入文档",
			'method'		:"POST",
			'onInit'        : function(){
			},
			'onUploadStart' : function(file){
				var orgId = $("#win #f_cc_companyid").val();
				if(!(orgId && orgId > 0)){
					$(inputId).uploadify('cancel');
					alert("请选择组织！");
				}else{
					$(inputId).uploadify('settings','formData', {"f_cc_companyid" : orgId, "chooseOption1" : $("#win #chooseOption1").val(), "chooseOption2" : $("#win #chooseOption2").val()});
					jQuery.messager.alert('批量导入','批量导入开始, 操作结果请稍后.');
				}
			},
			'onUploadSuccess' : function(file,data,response) {
				if(data != null && data != undefined && data != ''){
					jQuery.messager.alert('批量导入',data);
				}
			},
			'onUploadError' : function(file, errorCode, errorMsg, errorString) {
				if(errorMsg == '302'){
					jQuery.messager.alert('批量导入','批量导入失败，请检查登录状态或者无此权限!');
				}
	        }
		});
	}
	function exportExcel(){
		var pager = $("#easyui-datagrid").datagrid("getPager").data("pagination").options;;
		var page=pager.pageNumber;
		var rows=pager.pageSize;
		var f_cc_name=$("#f_cc_name").val();
		var f_cc_status=$("#f_cc_status").val();
		var f_cc_type=2;
		var sourceFlag=2;
		var sctt_startDate=$("#sctt_startDate").val();
		var sctt_endDate=$("#sctt_endDate").val();
		var f_cc_companyid=$("#f_cc_companyid").val();
		if(!(<%=roleType%>==3||<%=roleType%>==12)&&(!f_cc_companyid||f_cc_companyid==0||f_cc_companyid=='')){//
			alert("请选择客户");
			return;
		}
		$.ajax({
			url:"../../content/content_list.do",
			dataType : 'json',
			data : {f_cc_name : f_cc_name,
				f_cc_status:f_cc_status,
				sctt_startDate:sctt_startDate,
				sctt_endDate:sctt_endDate,
				sourceFlag:sourceFlag,
				f_cc_type:f_cc_type,
				f_cc_companyid:f_cc_companyid,
				page:1,
				rows:1},
			type : 'get',
			success:function(data) {
				page=1;
				rows=data.total;
				if(data.total>5000){
					alert("导出数量大于5000，请修改搜索条件，减少导出数量！目前数量:"+rows);
				}else{
					$.messager.confirm('导出内容','导出内容数量建议<span style="color:red;">控制在5000以内</span>，数量请查看右下角记录数，以保证运行质量，</br><span style="color:red">是否进行导出？</span>',function(r){
						if(r){
							var url="../../content/content_excel_list.do?f_cc_name="+f_cc_name+"&sctt_startDate="+sctt_startDate+"&sctt_endDate="+sctt_endDate+"&sourceFlag="+sourceFlag+"&f_cc_status="+f_cc_status+"&f_cc_type="+f_cc_type+"&f_cc_companyid="+f_cc_companyid+"&page="+page+"&rows="+rows;
							window.open(url);
						}
					});
				}
			}
		});
		
		
		
	}
</script>
	
	
	
</body>
</html>